//
//  AnalystArticleViewController.m
//  RedManStock
//
//  Created by lanou3g on 15/7/24.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "AnalystArticleViewController.h"
#import "MyHandle.h"
#import "MBProgressHUD.h"
@interface AnalystArticleViewController ()<UIWebViewDelegate>
@property (nonatomic,retain) UIActivityIndicatorView *activityIndicatorView;


@end

@implementation AnalystArticleViewController

//http://api.gongniucaijing.com/stock/price?code=000056&idfa=7B7C9B42-5C18-4EEB-A0F8-6708DE081AAE&machine=iPhone%205&os=iPhone%20OS%208.2&platform=1&protocolVersion=1.0&qudao=0000001&resolution=640%2A1136&token=d58f02522dac7e698a4600c8b18ff02c0b9fa6df&uuid=BULLSTOCK-79460017-C3E5-45EC-B98C-1DD541A61127&version=1.9.0&versionCode=190

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
//    self.automaticallyAdjustsScrollViewInsets=NO;
    
    self.webView=[[UIWebView alloc]initWithFrame:self.view.bounds];
    _webView.delegate=self;
    [self.view addSubview:self.webView];
    
    self.activityIndicatorView = [[UIActivityIndicatorView alloc]
                                  initWithFrame : CGRectMake(0.0f, 0.0f, 32.0f, 32.0f)] ;
    [self.activityIndicatorView setCenter: self.view.center] ;
    [self.activityIndicatorView setActivityIndicatorViewStyle: UIActivityIndicatorViewStyleWhite];
    [self.view addSubview : self.activityIndicatorView] ;
    
#warning 这里有问题，要分情况，是首页跳过来，还是分析师详情页跳过来的，无论是哪个，都要给self.webUrl赋值
    //    NSString *webUrl=self.analyst.viewPointSB.url;
    
    NSURL *url=[NSURL URLWithString:self.webUrl];
    NSURLRequest *request=[NSURLRequest requestWithURL:url];
    [self.webView loadRequest:request];
    
    
    
    
}

- (void)webViewDidStartLoad:(UIWebView *)webView
{
    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    [self.activityIndicatorView startAnimating];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [MBProgressHUD hideAllHUDsForView:self.view animated:YES];
    [self.activityIndicatorView stopAnimating];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
